package com.jcp.dao;

import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import com.jcp.entity.Stats;

import tk.mybatis.mapper.common.Mapper;
 
@Repository
public interface UserCountMapper extends Mapper<Stats>{

	@Select("select count(carNumber) from Users")
	public int selUserCount();
	@Select("select count(carNumber) from Users where (date(membership_expires_date)>=DATE_SUB(CURDATE(),INTERVAL 0 DAY))")
	public int selVipUserCount();
	@Select("select count(carNumber) from Users where remainder > 0 and (ISNULL(membership_expires_date) or (date(membership_expires_date)<DATE_SUB(CURDATE(),INTERVAL 0 DAY)))")
	public int selRechargeUserCount();
	@Select("select count(carNumber) from Users where remainder = 0 or ISNULL(remainder) and (ISNULL(membership_expires_date) or (date(membership_expires_date)<DATE_SUB(CURDATE(),INTERVAL 0 DAY)))")
	public int selOrdinaryUserCount();
}
